# 小张的体重
# 定义类
# 属性 :姓名,体重
# 方法 :跑步,吃东西  __init__  __str__
# 体重60.0斤 吃东西胖一斤,跑步减少0.5斤

class Human:
    def __init__(self,name,weight):
        self.name=name
        self.weight=weight

    def run(self):
        self.weight-=0.5
        print(f'{self.name}跑步了,瘦了0.5斤')

    def __str__(self):
        return f'小张当前的体重是{self.weight}'

    def eat(self):
        self.weight+=1
        print(f'小张吃了一顿大餐,胖了一斤')



xiaozhang = Human('小张',60.0)
print(xiaozhang.weight)
xiaozhang.run()
print(xiaozhang)
xiaozhang.eat()
print(xiaozhang)



